home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000063_icon-group-sender _Mon Mar 3 20:29:10 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Received: by cheltenham.cs.arizona.edu; Tue, 4 Mar 1997 08:22:55 MST
Date: Mon, 3 Mar 1997 20:29:10 -0600 (CST)
From: "Chris D. Tenaglia" <cdt@post.its.mcw.edu>
To: Mark Kot <kot@buteo.math.utk.edu>
Cc: icon-group@cs.arizona.edu
Subject: Re: reading reals
In-Reply-To: <5ff37v$r3n$1@gaia.ns.utk.edu>
Message-Id: <Pine.ULT.3.90.970303202232.23683A-100000@post.its.mcw.edu>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1251
#
# not much error checking done
# I include the other procedures as examples too
#
procedure main()
line := input("Enter A & B>")
a := real(parse(line,' \t')[1])
b := real(parse(line,' \t')[2])
write(real(a + b))
end
#
# prompt for an input string
#
procedure input(prompt)
writes(prompt)
return read()
end
#
# parse a string into a list with respec to a delimiter
#
procedure parse(line,delims)
static chars
chars := &cset -- delims
tokens := []
line ? while tab(upto(chars)) do put(tokens,tab(many(chars)))
return tokens
end
Chris Tenaglia (system manager) | cdt@post.its.mcw.edu
Medical College of Wisconsin |
8701 W. Watertown Plank Rd. | Ce que vous voyez est
Milwaukee, WI 53226 (414)456-8765 | ce que vous obtenez !
On 3 Mar 1997, Mark Kot wrote:
> Date: 3 Mar 1997 17:54:07 GMT
> From: Mark Kot <kot@buteo.math.utk.edu>
> To: icon-group@cs.arizona.edu
> Subject: reading reals
>
>
> What is the Icon analog to the C
> programming instruction
>
> scanf("%f%f", &x, &y); ?
>
> That is, what is the simplest (or most standard)
> way to read two real numbers (with intervening
> and/or preceding white space) from a line of
> input in Icon ?
>
> Many thanks !
>